﻿/*** 
 * @Author: Xavier 1305433186@qq.com
 * @Date: 2024-07-29 17:01:38
 * @LastEditors: Xavier 1305433186@qq.com
 * @LastEditTime: 2024-07-29 17:03:53
 * @FilePath: \KEIL-ARMd:\Users\HXD\Desktop\拓基\面板\JS32T031_SDK\User\modul_demo\ftmp_uart.h
 * @Description: 
 * @
 * @STAYTR
void BleSendOrder(uint8_t Order, uint8_t *value, uint32_t value_len);

void SetBleMtu(uint16 *len);UE (c) 2024 by ${Xavier}, All Rights Reserved. 
 */
/***
 * @Author: Xavier 1305433186@qq.com
 * @Date: 2024-06-29 20:08:32
 * @LastEditors: Xavier 1305433186@qq.com
 * @LastEditTime: 2024-07-11 17:08:37
 * @FilePath: \TREADMILL\example\ftmp_uart\ftmp_uart.h
 * @Description:
 * @
 * @STAYTRUE (c) 2024 by ${Xavier}, All Rights Reserved.
 */
#ifndef _FTMP_UART_H_
#define _FTMP_UART_H_
// #include "sdk_include.h"

/*帧头  帧尾*/
#define FRAME_HEADER 0XFE
#define FRAME_TAIL 0XFF

/*指令属性*/
#define ORDER_MCU_WRITE 0XF0
#define ORDER_BLE_WRITE 0XF1

/*指令*/
#define ORDER_BLE_STATUS 0X20
#define ORDER_SET_BLE_STATUS 0X21
#define ORDER_BLE_MTU 0X22
#define ORDER_MODEL 0X24
#define ORDER_FITNESS_MACHINE_FEATURE 0XCC
#define ORDER_TREADMILL_DATA 0XCD
#define ORDER_ROWER_DATA 0XD1
#define ORDER_TRAINING_STATUS 0XD3
#define ORDER_SPEED_RANGE 0XD4
#define ORDER_INCLINATION_RANGE 0XD5
#define ORDER_RESISTANCE_LEVEL 0XD6
#define ORDER_HEART_RATE_RANGE 0XD7
#define ORDER_POWER_RANGE 0XD8
#define ORDER_CONTROL_POINT 0XD9
#define ORDER_STATUS 0XDA
#define ORDER_EXTENSION_DATA 0X10

#define ORDER_SPEED_UNITS  0XF1
#define ORDER_APP_WRITE  0XF2
#define ORDER_MCU_NOTICE  0XF3
#define ORDER_HARDWARE_REVISION_STRING 0x27
// #define ORDER_INDOOR_BIKE_DATA 0XD2

/*执行结果*/
#define STATE_SUCCEED 0X00       // 成功
#define STATE_FAILURE 0X01       // 失败
#define STATE_FUN_EERROR 0X02    // 指令属性错误
#define STATE_ORDER_EERROR 0X03  // 指令不存在
#define STATE_LENFTH_EERROR 0X04 // 长度错误
#define STATE_SCOPE_EERROR 0X05  // 参数不符合范围
#define STATE_CRC_FAILURE 0X06   // 数据校验错误

/*蓝牙状态*/
#define BLE_STATUS_IDLE 0X00           // 空闲
#define BLE_STATUS_ADV 0X01            // 广播
#define BLE_STATE_STOP 0X02            // 广播停止
#define BLE_STATUS_CONNECT_BROKEN 0X02 // 链接断开
#define BLE_STATUS_CONNECTED 0X03      // 链接
#define BLE_STATUS_PAIRED 0X04         // 配对

// /*
// BleSendOrder
// 功能：MCU 写数据至蓝牙(手机)
// 调试使用
// */
// void McuSendOrder(uint8_t Order, uint8_t *value, uint32_t value_len);
// /*
// BleSendOrder
// 功能：蓝牙(手机)写数据至MCU
// */

// /*
// FtmpProtocolAnalysis()
// 协议解析
// 数据低位在前
// */
// void FtmpProtocolAnalysis(const uint8_t *data, int len);

#endif
